class classname: Data Members ------------ Member Functions ------------
def function-Name(self,argument1,argument2,...): Statements ---------- return value
def setPropertyName(self,argument1,argument2,...): self.datamember = argument1 self.datamember = argument2
class Rectangle: def setDimension(self,x,y): self.length = x self.breadth = y def area(self): a = self.length*self.breadth print("Area is",a) def perimeter(self): p=2*(self.length+self.breadth) print("Perimeter is ",p)
class box: def setDimension(self,x,y,z): self.L = x self.B = y self.H = z def volume(self): v = self.L*self.B*self.H print("Volume is ",v)
class circle: def setradius(this,n): this.R = n def area(this) : a =3.14*this.R**2 print("Area is ",a) def circumference(this): c =2*3.14*this.R print("Circumference is",c)